import http from '@/http'

export default {
    /**
     * 庄园列表
     * @param {number} page  页码
     * @param {Function} success 回调
     */
    list(page, success) {
        http.get('manor/list', {
            page: page
        }, success);
    },

    areas(success){
      http.get('area/all', {},success);
    },
    /**
     * 庄园检索
     * @param {number} page 页码
     * @param {string} key 关键词
     * @param {Function} success 回调
     */
    search(page, key, success) {
        http.get('manor/search', {
            page: page,
            key: key
        }, success);
    },
    /**
     * 添加庄园
     * @param {Object} manor 庄园
     * @param {Function} success 回调
     */
    save(manor, success) {
        http.postBody('manor/add', manor, success)
    },
    /**
     * 更新庄园
     * @param {Object} manor 庄园
     * @param {Function} success 回调
     */
    update(manor, success) {
        http.postBody('manor/edit', manor, success)
    },
    /**
     * 删除庄园
     * @param {number} id 庄园id
     * @param {Function} success 回调
     */
    delete(id, success) {
        http.get('manor/delete/' + id, success);
    }
}
